home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / asm_subr.arc / COMINCK < prev    next >
Encoding:
Text File  |  1985-12-15  |  1.6 KB  |  54 lines

  1. ;-------------------------cominck routine begins--------------------------+
  2. ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
  3. ;         page : 35
  4. ;
  5. ; NAME COMINCK
  6. ; ROUTINE FOR COMMUNICATIONS LINE INPUT CHECK
  7. ;
  8. ; FUNCTION: This routine checks but does not wait for input from one of
  9. ; the two serial communications lines.
  10. ; INPUT: Upon entry DX contains the unit number (0 for comm1: and 1 for
  11. ; comm2:).  During the routine, input is from the specified communications
  12. ; line.
  13. ; OUTPUT: If a byte is available, the routine returns with the flag
  14. ; condition NZ and the byte in AL.  If no byte is available then the
  15. ; routine returns with the flag condition Z and AL is meaningless.
  16. ; REGISTERS USED:  AH is modified.. DX is used for input and AL is used
  17. ; for output.
  18. ; SEGMENTS REFERENCED:  During the routine the system data segment is
  19. ; referenced.
  20. ; ROUTINES CALLED:  None
  21. ; SPECIAL NOTES: None
  22. ;
  23. ; ROUTINE TO CHECK FOR INPUT FROM A COMMUNICATIONS LINE
  24. ;
  25. cominck    proc    far
  26. ;
  27.     push    ds        ; save registers
  28.     push    dx
  29.     push    si
  30. ;
  31.     mov    si,dx        ; look up address of comm line
  32.     add    si,si        ; double to index into table
  33.     mov    dx,40h        ; segment of table
  34.     mov    ds,dx        ; set data segment to this table
  35.     mov    dx,[si]        ; now get it
  36.     add    dx,5        ; line status
  37.     in    al,dx        ; get it
  38.     test    al,1        ; receive buffer full ?
  39.     jz    cominckexit    ; yes, it is
  40. ;
  41.     mov    dx,[si]        ; data register
  42.     in    al,dx        ; get data
  43. ;
  44. cominckexit:
  45. ;
  46.     pop    si        ; restore registers
  47.     pop    dx
  48.     pop    ds
  49. ;
  50.     ret            ; return
  51. ;
  52. cominck    endp
  53. ;-------------------------cominck routine ends---------------------------+
  54.